import request from '@/utils/request'

// 获取文章列表的内容
export function getArticleListApi(query) {
  return request({
    method: 'get',
    url: '/article',
    params: query
  })
}

// 通过Id 来删除文章
export function delArticleByIdApi(articleId) {
  return request({
    method: 'DELETE',
    url: `/article/${articleId}`
  })
}

// 通过Id 来获取文章详情
export function getArticleDetailByIdApi(articleId) {
  return request({
    method: 'get',
    url: `/article/${articleId}`
  })
}

// 新增文章
export function addArticleApi(acticleForm) {
  return request({
    method: 'post',
    url: '/article',
    // body用data query用params
    data: acticleForm
  })
}

// 修改文章
export function setArticleApi(acticleForm) {
  return request({
    method: 'put',
    url: `/article/${acticleForm.id}`,
    data: acticleForm
  })
}